<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/common/head.jsp"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>收件箱</title>
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link rel="stylesheet" href="${resource }/css/bootstrap.css" />
		<link rel="stylesheet" type="text/css" href="${resource }/css/iconfont.css">
		<script src="${resource }/js/jquery-2.1.1.min.js"></script>
		<script src="${resource }/js/bootstrap.min.js?v=3.4.0"></script>
		<!-- 分页插件，依赖于jquery位于jquery之后 -->
		<script src="${resource }/js/page.js"></script>
		<title></title>
	</head>

	<body>
		<div class="row wrapper border-bottom white-bg page-heading">
			<div class="col-sm-4">
				<h2>站内信</h2>
				<ol class="breadcrumb">
					<li>
						<a href="tomain.do">主页</a>
					</li>
					<li>
						<strong>收件箱</strong>
					</li>
				</ol>
			</div>
		</div>
		<div class="row wrapper border-bottom white-bg page-heading">
			<div class="col-md-12">
				<!-- 用户列表--bootstrap高级表格使用 -->
				<div class="panel panel-default">
					<div class="panel-heading">
						收信列表
					</div>
					<div class="panel-body">
						<!--table-responsive响应式表格，会自动添加滚动条-->
						<div class="table-responsive">
							<!-- <div class="text-center">
								<a data-toggle="modal" class="btncs btn btn-primary" href="flowmanage.jsp#modal-form1" style="float: right;">添加流程</a>
							</div> -->
							<table class="table">
								<thead>
									<tr>
										<th>主题</th>
										<th>发件人</th>
										<th>发件日期</th>
										<!-- <th>附件</th> -->
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									<c:forEach items="${inbox }" var="inboxmail">
										<tr class="odd gradeX">
											<td><a href="detail.do?mailId=${inboxmail.mailId }" style="color: black;">${inboxmail.mailTitle }</a></td>
											<td>${inboxmail.sendName }</td>
											<td>${inboxmail.date }</td>
											<!-- <td>
												<a href="#">此处有附件</a>
											</td> -->
											<td>
												<a title="放入回收站" class="t-del" onclick="del(${inboxmail.id })"><i class="iconfont icon-shanchu"></i></a>
											</td>
										</tr>
									</c:forEach>
								</tbody>
							</table>
						</div>

						<!--分页显示-->
						<div class="row">
							<div class="col-md-6">
								<div class="pagination" style="margin: 0px;" role="alert" aria-live="polite" aria-relevant="all">显示 1 到 ${mailBox.getPages()} 页 记录数${mailBox.getTotal()}</div>
							</div>
							<!-- 动态分页 -->
							<div class="row">
								<div id="page" class="col-md-6" style="text-align: right;float:right;"></div>
							</div>
						</div>
						<!--分页显示-->
					</div>
				</div>
				<!--表格结束 -->
			</div>
		</div>
		<script>
		$(function(){
				/* 分页插件使用 */
				$("#page").page({/* #page是分页条div的id，调用分页插件page.js中封装的page函数*/
					pageNo:${mailBox.getPageNo()},/*向page函数传  当前页数，当前页数从controller获取*/
					totalPage:${mailBox.getPages()},/*向page函数传  总页数，总页数从controller获取*/
					url:"${mailBox.getUrl()}"/*向page函数传  处理分页的controller地址*/
				});
			}) 
		</script>
		<script>
			function del(x){
				var msg = "您真的确定要删除吗？\n\n请确认！"; 
				var id=x;
				if (confirm(msg)==true){ 
					window.location.href="addtrash.do?id="+id;
					return true; 
				}else{ 
					return false; 
				} 
			}
		</script>
	</body>

</html>